<?php
require('system/fpdf/fpdf.php');
require('system/classes/class.phpmailer.php');


$pdf=new FPDF();
$pdf->AddPage();
$pdf->SetTextColor(0, 158, 219);
$pdf->SetFont('Arial','B',16);
$pdf->Cell(0,10,'Invoice',0,1);
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('Arial','',12);
$pdf->Cell(0,10,'No:',0,1);
$pdf->Output("invoice.pdf", F);


$mail = new PHPMailer();
$mail->IsSMTP();// send via SMTP
$mail->Host = "localhost"; // SMTP servers
$mail->SMTPAuth = false; // turn on/off SMTP authentication
$mail->From = "carl@caramba-marketing.co.uk";
$mail->FromName = "Carlo";
$mail->AddAddress("carl@caramba-marketing.co.uk");
$mail->AddReplyTo("carl@caramba-marketing.co.uk");
$mail->WordWrap = 50;// set word wrap
//now Attach all files submitted
//echo (SITEBASE."/".$pdf-out);
$mail->AddAttachment("invoice.pdf", 'invoice.pdf');

//$mail->Body = "Name : ".$name."\n";
//
$mail->IsHTML(false);// send as HTML
$mail->Subject = "Sending a pdf as email";
if(!$mail->Send())
{
echo "Message was not sent <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}

var_dump($mail);
?>